package com.fei.spring.rabbitmq.eight;

import com.fei.spring.rabbitmq.utils.RabbitMQUtils;
import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;

//生产者
public class Producer02 {
    //普通交换机名称
    public static final String NORMAL_EXCHANGE = "normal_exchange";

    public static void main(String[] args) throws Exception {
        Channel channel = RabbitMQUtils.getChannel();
        //死信消息 设置TTL时间  expirantion过期时间
        AMQP.BasicProperties properties = new AMQP.BasicProperties().builder().expiration("10000").build();
        for (int i = 0; i < 10; i++) {
            String message = "info" + i;
            System.out.println("");
            channel.basicPublish(NORMAL_EXCHANGE,"wangwu",null,message.getBytes("UTF-8"));
        }
    }
}
